package com.crowntit.domain.auth.service;

import com.crowntit.domain.auth.adapter.port.ILoginPort;
import com.google.common.cache.Cache;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
public class WeixinLoginService implements ILoginService{
    @Resource
    private ILoginPort loginPort;
    @Resource
    private Cache<String, String> openidToken;

    @Override
    public String createQrCodeTicket() throws Exception {
        return loginPort.createQrCodeTicket();
    }


    @Override
    public String checkLogin(String ticket) {
        return openidToken.getIfPresent(ticket);
    }

}
